Ext.define('Admin.view.user.manager.UserManagerForm', {
    extend: 'Ext.form.Panel',
    alias: 'widget.userManagerForm',
    xtype: 'userManagerForm',

    requires: [
        'Ext.form.field.Text',
        'Ext.form.field.File',
        'Ext.form.field.Date',
        'Ext.form.field.Radio',
        'Ext.button.Button'
    ],

    controller: 'userManagerViewController',

    defaultType: 'textfield',

    layout: {
        type: 'vbox',
        align: 'stretch'
    },

    items: [{
            fieldLabel: '姓名',
            name: 'fullname',
            allowBlank: false,
            blankText: '此项不能为空'
        },
        {
            xtype: 'numberfield',
            name: 'age',
            fieldLabel: '年龄',
            hideTrigger: true,
            minValue: 16,
            blankText: '此项不能为空'
        },
        {
            xtype: 'fieldcontainer',
            fieldLabel: '性别',
            defaultType: 'radiofield',
            allowBlank: false,
            blankText: '此项不能为空',
            items: [{
                boxLabel: '男',
                name: 'sex',
                inputValue: 'male'
            }, {
                boxLabel: '女',
                name: 'sex',
                inputValue: 'female'
            }]
        }, {
            fieldLabel: '联系电话',
            name: 'phone',
            allowBlank: false,
            blankText: '此项不能为空',
            regex: /^((1[3,5,8][0-9])|(14[5,7])|(17[0,6,7,8])|(19[7]))\d{8}$/,
            regexText: '手机号码格式有错，例:13XXXXXXXXX',
        },
        {
            fieldLabel: '电子邮箱',
            name: 'email',
            vtype: 'email',
            allowBlank: false,
            blankText: '此项不能为空'
        },
        {
            fieldLabel: '出生日期',
            name: 'birthday',
            xtype: 'datefield',
            format: 'Y/m/d',
            allowBlank: false,
            blankText: '此项不能为空'
        }, {
            xtype: 'combobox',
            fieldLabel: '部门',
            name: 'dept',
            displayField: 'name',
            valueField: 'id',
            editable: false,
            allowBlank: false,
            blankText: '此项不能为空',
            store: Ext.create('Admin.store.organization.OrganizationStore')
        },
        {
            fieldLabel: '职位',
            name: 'job',
            allowBlank: false,
            blankText: '此项不能为空'
        },
        {
            fieldLabel: '入职日期',
            name: 'enterTime',
            xtype: 'datefield',
            format: 'Y/m/d',
            allowBlank: false,
            blankText: '此项不能为空'
        },
        {
            fieldLabel: '居住地址',
            name: 'address',
            allowBlank: false,
            blankText: '此项不能为空'
        }
    ],

    buttons: ['->', {
        text: '取消',
        listeners: {
            click: 'onFormCancelButton'
        }
    }, {
        text: '修改',
        formBind: true,
        ui: 'soft-green',
        listeners: {
            click: 'onFormSubmitButton'
        }
    }]

});